#!/usr/bin/env python
# Create: 2018/10/25
__author__ = '749B'
"""Twisted 发 POST"""

from twisted.internet import reactor
from twisted.web.client import getPage
import urllib.parse


def one_done(arg):
    print(arg)
    print(arg.decode())
    reactor.stop()


post_data = urllib.parse.urlencode({'check_data': 'TEST'})
post_data = post_data.encode('utf-8')
headers = {b'Content-Type': b'application/x-www-form-urlencoded'}
response = getPage(b'http://dig.chouti.com/login',
                   method=b'POST',
                   postdata=post_data,
                   cookies={},
                   headers=headers)
response.addBoth(one_done)

reactor.run()


